<script>
	import {
		mapGetters,
		mapActions
	} from 'vuex'
	import config from '@/admin.config.js'
	import {
		version
	} from './package.json'
	export default {
		computed: {
			...mapGetters({
				isTokenValid: 'user/isTokenValid'
			})
		},
		methods: {
			...mapActions({
				init: 'app/init'
			})
		},
		onPageNotFound(msg) {
			uni.redirectTo({
				url: config.error.url
			})
		},
		onLaunch: function() {
			// #ifdef H5
			console.log(
				`%c uni-admin %c v${version} `,
				'background:#35495e ; padding: 1px; border-radius: 3px 0 0 3px;  color: #fff',
				'background:#007aff ;padding: 1px; border-radius: 0 3px 3px 0;  color: #fff; font-weight: bold;'
			)
			// #endif
			// 线上示例使用
			// console.log('%c uni-app官方团队诚邀优秀前端工程师加盟，一起打造更卓越的uni-app & uniCloud，欢迎投递简历到 hr2013@dcloud.io', 'color: red
			console.log('App Launch')

			// this.$mdb=uniCloud.database()
			// this.$mdbCmd=uniCloud.database().command
			// console.log(this.$mdb)
			// this.init()

		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		},
		onError: function(res) {
			console.log('on error', e)
			const user = uni.getStorageSync('userinfo')
			const data = {
				message: res,
				user: user
			}
			uniCloud.callFunction({
				name: 'adderrorlog',
				data: data
			}).then(res => {
				console.log(res)
			})
		},
		onUnload() {
			uni.setStorageSync('ces', 1)
		}
	}
</script>

<style>
	@import '@/common/uni.css';
	@import '@/common/uni-icons.css';

	@font-face {
		font-family: 'ALKATIPTor';
		src: url('@/static/font/ALKATIPTor.eot');
		src: url('@/static/font/ALKATIPTor.eot') format('embedded-opentype'),
			url('@/static/font/ALKATIPTor.woff2') format('woff2'),
			url('@/static/font/ALKATIPTor.woff') format('woff'),
			url('@/static/font/ALKATIPTor.ttf') format('truetype')
	}

	.akf {
		font-family: ALKATIPTor;
	}

	.flex {
		display: flex;
	}

	.row {
		flex-direction: row;
	}

	.flex-wrap {
		flex-wrap: wrap;
	}

	.flex-nowrap {
		flex-wrap: nowrap;
	}

	.column {
		flex-direction: column;
	}

	.row-center {
		justify-content: center;
	}

	.column-center {
		align-content: center;
	}


	uni-page-body {
		color: #000 !important;
	}
</style>
